/***************************************************************************
创建者：华磊
 开始时间：         : 2020.11.09
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   程序寸动视窗
*                                                                         *
 ***************************************************************************/
#ifndef JOGVIEW_H
#define JOGVIEW_H

#include "jogview_global.h"
#include <QDialog>
#include <QLabel>
#include <QProgressBar>
#include <../CommunicateDelegate/globaldata.h>

namespace Ui {
class JogView;
}

/**
 * @brief The JogView class　程序寸动视窗类
 */
class JOGVIEWSHARED_EXPORT JogView :public QDialog
{
    Q_OBJECT

public:
    explicit JogView(int styleId,int coRobotFlag,GlobalData *globalDataIn,QWidget *parent = 0);
    ~JogView();

public:
    void changePageAxisStyleUpdate(bool isJointShow, int totalAxisCountIn, int pageIdIn, int onePageMaxAxisCount,
                                   std::vector<int> axisUnitIn,
                                   std::vector<std::vector<float> > axisLimitIn);
    void updateAxisPositionShow(bool isJointShow, int totalAxisCountIn, int pageIdIn, int onePageMaxAxisCount,
                                std::vector<double> positionValueIn);

    void initialDisplayStyle(int styleId);

signals:
    void setDragControl_signal(bool isOn);
    void displayJoyStickView_signal(bool isShow);
    void clearMsgAndServoOn_signal();
    void manualChangeSignal(int onOff);

    /**
     * @brief pushButton_L1_pressedSignal       左L1~L6按钮按压时发射信号函数
     */
    void pushButton_L1_pressedSignal();
    void pushButton_L2_pressedSignal();
    void pushButton_L3_pressedSignal();
    void pushButton_L4_pressedSignal();
    void pushButton_L5_pressedSignal();
    void pushButton_L6_pressedSignal();
    void pushButton_L7_pressedSignal();

    /**
     * @brief pushButton_L1_releasedSignal      左L1~L6按钮释放时发射信号函数
     */
    void pushButton_L1_releasedSignal();
    void pushButton_L2_releasedSignal();
    void pushButton_L3_releasedSignal();
    void pushButton_L4_releasedSignal();
    void pushButton_L5_releasedSignal();
    void pushButton_L6_releasedSignal();
    void pushButton_L7_releasedSignal();

    /**
     * @brief pushButton_R1_pressedSignal       右R1~R6按钮按压时发射信号函数
     */
    void pushButton_R1_pressedSignal();
    void pushButton_R2_pressedSignal();
    void pushButton_R3_pressedSignal();
    void pushButton_R4_pressedSignal();
    void pushButton_R5_pressedSignal();
    void pushButton_R6_pressedSignal();
    void pushButton_R7_pressedSignal();

    /**
     * @brief pushButton_R1_releasedSignal      右R1~R6按钮释放时发射信号函数
     */
    void pushButton_R1_releasedSignal();
    void pushButton_R2_releasedSignal();
    void pushButton_R3_releasedSignal();
    void pushButton_R4_releasedSignal();
    void pushButton_R5_releasedSignal();
    void pushButton_R6_releasedSignal();
    void pushButton_R7_releasedSignal();

private slots:

    /**
     * @brief on_pushButton_L1_pressed          左L1~L6按钮按压时响应槽函数
     */
    void on_pushButton_L1_pressed();
    void on_pushButton_L2_pressed();
    void on_pushButton_L3_pressed();
    void on_pushButton_L4_pressed();
    void on_pushButton_L5_pressed();
    void on_pushButton_L6_pressed();
//    void on_pushButton_L7_pressed();

    /**
     * @brief on_pushButton_L1_released         左L1~L6按钮释放时响应槽函数
     */
    void on_pushButton_L1_released();
    void on_pushButton_L2_released();
    void on_pushButton_L3_released();
    void on_pushButton_L4_released();
    void on_pushButton_L5_released();
    void on_pushButton_L6_released();
//    void on_pushButton_L7_released();

    /**
     * @brief on_pushButton_R1_pressed          右R1~R6按钮按压时响应槽函数
     */
    void on_pushButton_R1_pressed();
    void on_pushButton_R2_pressed();
    void on_pushButton_R3_pressed();
    void on_pushButton_R4_pressed();
    void on_pushButton_R5_pressed();
    void on_pushButton_R6_pressed();
//    void on_pushButton_R7_pressed();

    /**
     * @brief on_pushButton_R1_released         右R1~R6按钮释放时响应槽函数
     */
    void on_pushButton_R1_released();
    void on_pushButton_R2_released();
    void on_pushButton_R3_released();
    void on_pushButton_R4_released();
    void on_pushButton_R5_released();
    void on_pushButton_R6_released();
//    void on_pushButton_R7_released();

    void on_checkBox_sevon_clicked(bool checked);

    void on_button_clrMsgAndServoOn_clicked();

    void on_checkBox_joyStick_clicked(bool checked);

    void on_checkBox_dragMode_clicked(bool checked);

private:

    /**
     * @brief jogUseLimit       寸动功能的使用限制
     * @param type
     * @param axisCount
     */
    void jogUseLimit(int isJointJogIn, int totalAxisIn);

private:

    //*****VIEW******************************************************
    /**
     * @brief j1Value           轴的关节值
     */
    QVector<float> jValue;
    QVector<QLabel*> jValueLable;

    /**
     * @brief j1UnitLabel       关节值显示单位 0:deg  1:mm
     */
    QVector<QString> jUnitStr;
    QVector<QLabel*> jUnitLable;

    /**
     * @brief j1ProgressValue   进度条刻度
     */
//    QVector<int> jProgressValue;
    QVector<QProgressBar*> jProgressValueBar;

    /**
     * @brief j1ShowFlag        各轴相关控件是否显示标识 0:隐藏 1:显示
     */
    //QVector<int> jShowFlag;
    QVector<QWidget*> jShowWidget;

    //*****DATA********************************************************


    /**
     * @brief initFlag              初始化flag
     */
//    bool initFlag;
    /**
     * @brief axisCount             所有关节轴数
     */
    int totalAxisCount;

    /**
     * @brief robotAxisCount        轴数(用于存储 实际的轴数)
     */
//    int robotAxisCount;

    /**
     * @brief axisUnit              轴单位
     */
    QVector<int> axisUnit;          //0 deg 1 mm
    /**
     * @brief axisLimit             软限位(如果改变设置,重新获取?)
     */
    QVector<QVector <float> >  axisLimit;
    /**
     * @brief extAxisCount          外部轴数[LV1]
     */
//    int extAxisCount;

private:
    Ui::JogView *ui;
    GlobalData *globalData;
};

#endif // JOGVIEW_H
